<?php namespace Home\Controller; 
use Hdphp\Controller\Controller;
/**
 *  图册控制器
 */
class ImgsController extends Controller{
    	//首页
    	public function index(){
    		$theme = new \Common\Model\Theme();
    		$picture = new \Common\Model\Picture();
    		// 先查出所有的主题
    		$data = $theme->get();
    		$thid = Q('get.thid',0,'intval');
    		if ($thid) {
    			//查出指定的图片
    			$Data = $picture->join('theme','theme_id','=','thid')->where(array('theme_id'=>$thid))->orderBy('sort','DESC')->get();
    			$pData = empty($Data) ? array() : $Data;
    		}else {
    			//查出所有图片
    			$Data = $picture->orderBy('sort','DESC')->get();
    			$pData = empty($Data) ? array() : $Data;
    			foreach ($Data as $k => $v) {
    				$pData[$k]['animation'] = '';
    			}
    		}
    		$this->assign('pData',$pData);
    		$this->assign('themeData',$data);
    		$this->display();
    	}
}
